<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/8/29
  Time: 19:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="/js/jquery-3.4.1.min.js"></script>
    <style>
        div{
            margin:auto;
            height: 100px;
            text-align: center;
            border: 1px solid white;
            background-color: pink;
            color: darkorange;
            font-size: 28px;
        }
    </style>
    <script>
        $(
            function () {
                $("#div1").on("click",function () {
                    $.ajax({
                        url:"/test02",
                        data:{
                            name:"懒羊羊"
                        },
                        dataType:"json",
                        success:function (res) {
                            $("#div2").text("我是DJ"+res.name+",青青草原我最狂。");
                        },
                        error:function () {
                            alert("服务器出现异常")
                        }
                    })
                })
            }
        )
    </script>
</head>
<body>
    <div id="div2">我是DJ喜羊羊，青青草原我最狂。</div>
    <div>不服来！battle！</div>
    <div id="div1">双击666</div>
</body>
</html>
